Learning Objectives

After completing this lesson, you’ll be able to:

Instructions

In this lesson, you will:

Resources

Introduction

Frank

In a previous project, you created a workspace to calculate the sizes of neighborhood parks and their average size.

You are working with your FME Flow administrator, Frank, to publish the workspace to FME Flow. Before you publish it, you want to improve some of the functionality and implement a custom translation log.

Frank suggests you carry out the following upgrades:

1) Open Starting Workspace

Starting workspace

You can see that the workspace reads some MapInfo parks data, filters out dog parks, calculates park area and average area, creates labels, and writes out the data out to DWG.

There are two existing published parameters - one for the source dataset and one for the destination:

Starting user parameters

Since the source dataset will never change, we will create a new parameter for the destination and delete these two parameters. Delete them both now.

2) Add User Parameter

If we write the output to a folder specific to the current user, we need to know who that user is.

Adding a Text user parameter for Username

3) Add User Parameter

We can implement the requirements here in various ways; we'll use the version that involves sharing user parameters.

OutputFolder user parameter

4) Set Output Location

Now, let's use the two parameters we've created. Ensure you deleted the two existing source/destination user parameters in step 1; otherwise, this step won't work!

$(OutputFolder)\$(Username).dwg

Using embedded parameters

You've now concatenated and embedded the two user parameters into the FME parameter.

5) Add User Parameter

The next task is to check whether dog parks are required in the output. The Tester transformer in the workspace shows that an attribute (DogParks) has a value of Y or N to denote its status. We need to ask the user and add their decision to the Tester.

Configuring Choice parameter

6) Update Tester

We can use the new DogParks parameter in the Tester to control the filtering behavior.

$(DogParks) = Yes

Dog park filtering logic

7) Add User Parameter

The next task is to allow the user to pick which attribute to use for a label.

As noted in the previous training section, if we publish the label parameter in the LabelPointReplacer, the user can enter text and select an attribute. We want them to have to select an attribute and not be able to enter text.

Creating the Select Attribute parameter

8) Update LabelPointReplacer

Now, let's use the LabelAttribute user parameter to let the user choose the attribute used to label the points.

@Value($(LabelAttribute))

Using @Value() to get the value of an attribute specified by the user with an Attribute Name user parameter

9) Add Log Writer

The final task is to create a custom CSV log. That is easy to do.

Writer Format CSV (Comma Separated Value)
Writer Dataset C:\FMEData\Output\Training
Writer Parameters Overwrite Existing File: No
Write Field Names Row: If Writing First Row
Add Feature Type(s) > CSV File Definition Manual...

Writer feature type parameters

User attributes

10) Connect Feature Type

We need a single record to trigger this feature type, but only one feature; otherwise, we will get multiple records.

TranslationLog writer feature type

11) Set Output Folder

We should set the output location for the log relative to where the user files are being written.

Linking to destination user parameter

12) Set User Attribute

The last step is to provide values for the User and Date fields of the translation log (CSV writer).

Editing an attribute value directly on a writer feature type

Setting a value on the writer feature type

This is another example of sharing user parameters. This parameter is now used here and in the ACAD writer name.

13) Set Date Attribute

Now we have to provide a value to the Date attribute.

Setting date attribute value on writer feature type

Optional Challenge: Control Rounding with Parameter, Improve Log

If you have time for one more task, add a transformer to round the ParkArea and AverageParkArea attributes and create a user parameter to control how that rounding occurs? You can choose any parameter that would be best for allowing the user to select the number of decimal places to round to. It could be a Choice parameter, a Choice with an Alias parameter, a Number parameter, or something else.

You could also expand on the information in the CSV log file; for example, add the build of FME used in the translation, which is available as a parameter called $(FME_BUILD_NUM).

Challenge Answer: Open after attempting the challenge.